package cn.kk.librarysystem.controller;
/*
 *@author KK on 2022.10.15 16:30
 */

import cn.kk.librarysystem.mapper.BookMapper;
import cn.kk.librarysystem.pojo.Book;
import cn.kk.librarysystem.service.BookService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("/book")
@Api(value = "图书操作控制层")
public class BookController {
    @Autowired
    private BookService bookService;

    @ApiOperation("获取学生名下可用的图书")
    @RequestMapping("/getUserBook")
    public String getUserBook(int id, HttpSession session){
        List<Book> stuBook = bookService.getStuBook(id);
        session.setAttribute("stuBooks",stuBook);
        return "stuBook";
    }
}
